package com.googlecode.lohr.parser.combinators.matcher;

import com.googlecode.lohr.parser.combinators.MatchResults;

public abstract class Matcher
{
	/**
	 * Do not call this method directly, use the MatchContext.doMatch method
	 * to perform parsing.
	 * This method is used by MatchContext.   
	 */
	abstract public MatchResults match(MatchContext context, int start);
	
	private String _label;
	
	public Matcher() {
		_label= getClass().getName();
	}
	
	public String getLabel() {
		return _label;
	}
	public Matcher setLabel(String label) {
		_label= label;
		return this;
	}

	public Matcher optionFor(ChoiceMatcher choiceMatcher) {
		choiceMatcher.addChoice(this);
		return this;
	}

}